package com.zy.smbms.service;

import com.zy.smbms.UserMapper.SmbmsProviderMapper;
import com.zy.smbms.pojo.SmbmsProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SmbmsProviderServiceImpl implements SmbmsProviderService
{
    @Autowired
    private SmbmsProviderMapper smbmsProviderMapper;
    //按供应商姓名，分页查询
    @Override
    public List<SmbmsProvider> selectProviderListByName(Map<String, Object> map)
    {
        return smbmsProviderMapper.selectProviderListByName(map);
    }

    //查询所有供应商信息
    @Override
    public int selectTotalByProName(SmbmsProvider provider)
    {
        return smbmsProviderMapper.selectTotalByProName(provider);
    }

    //根据主键查询供应商信息
    @Override
    public SmbmsProvider selectProviderById(Long id)
    {
        return smbmsProviderMapper.selectByPrimaryKey(id);
    }

    //根据主键更新供应商信息
    @Override
    public int updateProviderById(SmbmsProvider provider)
    {
        return smbmsProviderMapper.updateByPrimaryKeySelective(provider);
    }

    //根据主键删除供应商信息
    @Override
    public int deleteProviderById(Long id)
    {
        return smbmsProviderMapper.deleteByPrimaryKey(id);
    }

    //增加供应商信息
    @Override
    public int addProvider(SmbmsProvider provider)
    {
        return smbmsProviderMapper.insertSelective(provider);
    }

    //查询供应商来源
    @Override
    public List<SmbmsProvider> selectBillByProviderId()
    {
        return smbmsProviderMapper.selectBillByProviderId();
    }

}
